<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类型比较-typeof</title>
</head>
<body>
<h3>typeof instance === "object"。任何 constructed 对象实例的特殊非数据结构类型，也用做数据结构：new Object，new Array，new Map，new Set，new WeakMap，new WeakSet，new Date，和几乎所有通过 new keyword 创建的东西。</h3>
<h3>instanceof运算符用于检测构造函数的prototype 属性是否出现在某个实例对象的原型链上。</h3>

<pre>
    1.typeof 一般只能返回如下几个结果： number, boolean, string, function, object, undefined。
    2.对于 Array, Null 等特殊对象使用 typeof 一律返回 object， 这正是 typeof 的局限性。
    3.instanceof 用于判断一个变量是否属于某个对象的实例。
</pre>
</body>
<script>
    // undefined：typeof instance === "undefined"
    // Boolean：typeof instance === "boolean"
    // Number：typeof instance === "number"
    // String：typeof instance === "string
    // BigInt：typeof instance === "bigint"
    // Symbol ：typeof instance === "symbol"

    var instance_undefined
    console.log('undefined   ',typeof instance_undefined === "undefined")

    var instance_Boolean =  true
    console.log('Boolean   ',typeof instance_Boolean === "boolean")

    var instance_number = 1.0
    console.log('number   ',typeof instance_number === "number")

    var instance_string = 'xxx'
    console.log('string   ',typeof instance_string === "string")

    // var instance_bigint = 10n
    var instance_bigint = BigInt(10)
    console.log('bigint  ',typeof instance_bigint === "bigint")

    var instance_symbol = Symbol(123)
    console.log('symbol   ',typeof instance_symbol === "symbol")


</script>
</html>